import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralFileCatalog = (params) => {
  params.head.transCode = 'queryGeneralFileCatalog';
  return request({
    url: '/general/generalFileCatalog/queryGeneralFileCatalog',
    method: 'post',
    data: params
  })
}
//查询树形目录
export const queryFileCatalogTree = (params) => {
  params.head.transCode = 'queryFileCatalogTree';
  return request({
    url: '/general/generalFileCatalog/queryFileCatalogTree',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralFileCatalogListPage = (params) => {
  params.head.transCode = 'queryGeneralFileCatalogListPage';
  return request({
    url: '/general/generalFileCatalog/queryGeneralFileCatalogListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralFileCatalog = (params) => {
  params.head.transCode = 'saveGeneralFileCatalog';
  return request({
    url: '/general/generalFileCatalog/saveGeneralFileCatalog',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralFileCatalogList = (params) => {
  params.head.transCode = 'saveGeneralFileCatalogList';
  return request({
    url: '/general/generalFileCatalog/saveGeneralFileCatalogList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralFileCatalog = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFileCatalog';
  return request({
    url: '/general/generalFileCatalog/saveOrUpdateGeneralFileCatalog',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralFileCatalogList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFileCatalogList';
  return request({
    url: '/general/generalFileCatalog/saveOrUpdateGeneralFileCatalogList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralFileCatalog = (params) => {
  params.head.transCode = 'updateGeneralFileCatalog';
  return request({
    url: '/general/generalFileCatalog/updateGeneralFileCatalog',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralFileCatalog = (params) => {
  params.head.transCode = 'deleteGeneralFileCatalog';
  return request({
    url: '/general/generalFileCatalog/deleteGeneralFileCatalog',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralFileCatalogList = (params) => {
  params.head.transCode = 'deleteGeneralFileCatalogList';
  return request({
    url: '/general/generalFileCatalog/deleteGeneralFileCatalogList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralFileCatalogExcel = (params) => {
  downloadExcel({
    url: '/general/generalFileCatalog/exportGeneralFileCatalogExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
